&ANALYZE-SUSPEND _VERSION-NUMBER UIB_v9r12 GUI
&ANALYZE-RESUME
&Scoped-define WINDOW-NAME CURRENT-WINDOW
&Scoped-define FRAME-NAME Dialog-Frame
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Dialog-Frame 
/*------------------------------------------------------------------------
    File        : dlgtt.w
    Purpose     : Pops up a dialog that gets the parameters for the query

    Author(s)   : Bruce Gruenbaum
    
    Notes       : This file contains sample code which may assist you in 
                  creating applications.  You may use the code as you see 
                  fit. If you modify the code or include it in another 
                  software program, you will refrain from identifying 
                  Progress Software as the supplier of the code, or using 
                  any Progress Software trademarks in connection with 
                  your use of the code. 
                  
                  THE CODE IS NOT SUPPORTED BY PROGRESS SOFTWARE AND IS 
                  PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
                  INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF 
                  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR 
                  NONINFRINGEMENT.
------------------------------------------------------------------------*/
/*          This .W file was created with the Progress AppBulder.       */
/*----------------------------------------------------------------------*/

/* ***************************  Definitions  ************************** */

/* Parameters Definitions ---                                           */

/* Local Variable Definitions ---                                       */

DEFINE OUTPUT PARAMETER ocTables AS CHARACTER  NO-UNDO.
DEFINE OUTPUT PARAMETER ocForEach AS CHARACTER  NO-UNDO.
DEFINE OUTPUT PARAMETER ocFields AS CHARACTER  NO-UNDO.
DEFINE OUTPUT PARAMETER ocTableName AS CHARACTER  NO-UNDO.
DEFINE OUTPUT PARAMETER oiRows AS INTEGER  NO-UNDO.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK 

/* ********************  Preprocessor Definitions  ******************** */

&Scoped-define PROCEDURE-TYPE Dialog-Box
&Scoped-define DB-AWARE no

/* Name of first Frame and/or Browse and/or first Query                 */
&Scoped-define FRAME-NAME Dialog-Frame

/* Standard List Definitions                                            */
&Scoped-Define ENABLED-OBJECTS cTables cForEach cFields cTableName iRows ~
Btn_OK Btn_Cancel RECT-2 
&Scoped-Define DISPLAYED-OBJECTS cTables cForEach cFields cTableName iRows 

/* Custom List Definitions                                              */
/* List-1,List-2,List-3,List-4,List-5,List-6                            */

/* _UIB-PREPROCESSOR-BLOCK-END */
&ANALYZE-RESUME



/* ***********************  Control Definitions  ********************** */

/* Define a dialog box                                                  */

/* Definitions of the field level widgets                               */
DEFINE BUTTON Btn_Cancel AUTO-END-KEY 
     LABEL "Cancel" 
     SIZE 15 BY 1.17
     BGCOLOR 8 .

DEFINE BUTTON Btn_OK AUTO-GO 
     LABEL "OK" 
     SIZE 15 BY 1.17
     BGCOLOR 8 .

DEFINE VARIABLE cForEach AS CHARACTER 
     VIEW-AS EDITOR SCROLLBAR-VERTICAL
     SIZE 58 BY 5.94 NO-UNDO.

DEFINE VARIABLE cFields AS CHARACTER FORMAT "X(256)":U 
     LABEL "Fields" 
     VIEW-AS FILL-IN 
     SIZE 47 BY 1 NO-UNDO.

DEFINE VARIABLE cTableName AS CHARACTER FORMAT "X(256)":U 
     LABEL "Table Name" 
     VIEW-AS FILL-IN 
     SIZE 47 BY 1 NO-UNDO.

DEFINE VARIABLE cTables AS CHARACTER FORMAT "X(256)":U 
     LABEL "Tables" 
     VIEW-AS FILL-IN 
     SIZE 52 BY 1 NO-UNDO.

DEFINE VARIABLE iRows AS INTEGER FORMAT "->,>>>,>>9":U INITIAL 0 
     LABEL "Rows" 
     VIEW-AS FILL-IN 
     SIZE 14 BY 1 NO-UNDO.

DEFINE RECTANGLE RECT-2
     EDGE-PIXELS 2 GRAPHIC-EDGE  NO-FILL 
     SIZE 60 BY 6.67.


/* ************************  Frame Definitions  *********************** */

DEFINE FRAME Dialog-Frame
     cTables AT ROW 1.22 COL 8 COLON-ALIGNED
     cForEach AT ROW 3.17 COL 3 NO-LABEL
     cFields AT ROW 9.56 COL 13 COLON-ALIGNED
     cTableName AT ROW 10.78 COL 13 COLON-ALIGNED
     iRows AT ROW 11.94 COL 13 COLON-ALIGNED
     Btn_OK AT ROW 1.22 COL 64
     Btn_Cancel AT ROW 2.5 COL 64
     RECT-2 AT ROW 2.67 COL 2
     "FOR EACH Statement:" VIEW-AS TEXT
          SIZE 23 BY .61 AT ROW 2.44 COL 3
     SPACE(53.99) SKIP(10.13)
    WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER 
         SIDE-LABELS NO-UNDERLINE THREE-D  SCROLLABLE 
         TITLE "Temp Table Query"
         DEFAULT-BUTTON Btn_OK CANCEL-BUTTON Btn_Cancel.


/* *********************** Procedure Settings ************************ */

&ANALYZE-SUSPEND _PROCEDURE-SETTINGS
/* Settings for THIS-PROCEDURE
   Type: Dialog-Box
   Allow: Basic,Browse,DB-Fields,Query
   Other Settings: COMPILE
 */
&ANALYZE-RESUME _END-PROCEDURE-SETTINGS



/* ***********  Runtime Attributes and AppBuilder Settings  *********** */

&ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
/* SETTINGS FOR DIALOG-BOX Dialog-Frame
   Custom                                                               */
ASSIGN 
       FRAME Dialog-Frame:SCROLLABLE       = FALSE
       FRAME Dialog-Frame:HIDDEN           = TRUE.

ASSIGN 
       cForEach:RETURN-INSERTED IN FRAME Dialog-Frame  = TRUE.

/* _RUN-TIME-ATTRIBUTES-END */
&ANALYZE-RESUME

 



/* ************************  Control Triggers  ************************ */

&Scoped-define SELF-NAME Dialog-Frame
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
ON WINDOW-CLOSE OF FRAME Dialog-Frame /* Temp Table Query */
DO:
  APPLY "END-ERROR":U TO SELF.
END.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


&Scoped-define SELF-NAME Btn_OK
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK Dialog-Frame
ON CHOOSE OF Btn_OK IN FRAME Dialog-Frame /* OK */
DO:
  /* Set all the variables and tie them back to the output parameters */
  ASSIGN
    cTables
    cForEach
    cFields
    cTableName
    iRows
    ocTables = cTables
    ocForEach = cForEach
    ocFields = cFields
    ocTableName = cTableName
    oiRows = iRows
  .
    
END.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


&UNDEFINE SELF-NAME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Dialog-Frame 


/* ***************************  Main Block  *************************** */

/* Parent the dialog-box to the ACTIVE-WINDOW, if there is no parent.   */
IF VALID-HANDLE(ACTIVE-WINDOW) AND FRAME {&FRAME-NAME}:PARENT eq ?
THEN FRAME {&FRAME-NAME}:PARENT = ACTIVE-WINDOW.


/* Now enable the interface and wait for the exit condition.            */
/* (NOTE: handle ERROR and END-KEY so cleanup code will always fire.    */
MAIN-BLOCK:
DO ON ERROR   UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
   ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
  RUN enable_UI.
  WAIT-FOR GO OF FRAME {&FRAME-NAME}.
END.
RUN disable_UI.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


/* **********************  Internal Procedures  *********************** */

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI Dialog-Frame  _DEFAULT-DISABLE
PROCEDURE disable_UI :
/*------------------------------------------------------------------------------
  Purpose:     DISABLE the User Interface
  Parameters:  <none>
  Notes:       Here we clean-up the user-interface by deleting
               dynamic widgets we have created and/or hide 
               frames.  This procedure is usually called when
               we are ready to "clean-up" after running.
------------------------------------------------------------------------------*/
  /* Hide all frames. */
  HIDE FRAME Dialog-Frame.
END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI Dialog-Frame  _DEFAULT-ENABLE
PROCEDURE enable_UI :
/*------------------------------------------------------------------------------
  Purpose:     ENABLE the User Interface
  Parameters:  <none>
  Notes:       Here we display/view/enable the widgets in the
               user-interface.  In addition, OPEN all queries
               associated with each FRAME and BROWSE.
               These statements here are based on the "Other 
               Settings" section of the widget Property Sheets.
------------------------------------------------------------------------------*/
  DISPLAY cTables cForEach cFields cTableName iRows 
      WITH FRAME Dialog-Frame.
  ENABLE cTables cForEach cFields cTableName iRows Btn_OK Btn_Cancel RECT-2 
      WITH FRAME Dialog-Frame.
  VIEW FRAME Dialog-Frame.
  {&OPEN-BROWSERS-IN-QUERY-Dialog-Frame}
END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

